package model;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Map;
import xl.Address;
import xl.XLException;


public class XLBufferedReader extends BufferedReader {
    public XLBufferedReader(String name) throws FileNotFoundException {
        super(new FileReader(name));
    }

    public void load(Map<Address, Cell> map) {
    	CellFactory fac = new CellFactory();
        try {
            while (ready()) {
                String entry[] = readLine().split("=");
                map.put(new Address(entry[0]), fac.createCell(entry[1]));  	
               
            }
        } catch (Exception e) {
            throw new XLException(e.getMessage());
        }
    }
    
   
}
